#!/bin/bash


emerge --sync
layman -S

FILE=/usr/portage/profiles/base/package.use.mask
if  cat $FILE|grep -E '^sys\-auth\/polkit systemd' ; then
    perl -pi -e 's{^sys\-auth\/polkit\s+systemd}{#sys-auth/polkit systemd}' $FILE
fi

FILE=/usr/portage/profiles/package.mask
grep -v 'xf86-input-evdev' $FILE > $FILE.tmp
mv $FILE.tmp $FILE

emerge -uDNtva --keep-going world
emerge -a --depclean
revdep-rebuild -i
emerge @preserved-rebuild
emerge -uDNtva --keep-going world
etc-update
eix-update
eix-remote update
